<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />

<meta http-equiv="Cache-Control" content="no-siteapp" /> 

<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="css/style.css"/>       
<link href="assets/css/codemirror.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/ace.min.css" />
 <link rel="stylesheet" href="assets/css/font-awesome.min.css" />
 <script src="js/jquery-2.1.4.min.js"></script>  
<!--[if IE 7]>
		  <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

<title>新增设备</title>
</head>
<body>
<div class="clearfix" id="add_picture">
<div id="scrollsidebar" class="left_Treeview">
   
   <div >
   <div class="type_title" style="margin-left: 10px">添加设备</div>
	<form action="" method="post" class="form form-horizontal" id="form-article-add">
		<div class="clearfix cl">
         <label class="form-label col-2"><span class="c-red">*</span>手机号码：</label>
		 <div class="formControls col-10"><input type="text" class="input-text" value="" placeholder="" id="phone" name=""></div>
		</div>
		<div class=" clearfix cl">
         <label class="form-label col-2"><span class="c-red">*</span>用户密码：</label>
	     <div class="formControls col-10"><input type="text" class="input-text" value="" placeholder="" id="pwd" name=""></div>
		</div>
		
		
		<div class="clearfix cl">
			<label class="form-label col-2"><span class="c-red">*</span>车牌号码：</label>
			<div class="formControls col-10">
				<input type="text" class="input-text" value="" placeholder="" id="carno" name="">
			</div>
        </div>
        <div class="clearfix cl">
			<label class="form-label col-2"><span class="c-red">*</span>设备编号：</label>
			<div class="formControls col-10">
				<input type="text" class="input-text" value="" placeholder="" id="deviceno" name="">
			</div>
		</div>
		
		<div class="clearfix cl" >
			<div class="Button_operation" style="margin-left: 10px">
				<button onClick="article_save_submit();" class="btn btn-primary radius"><i class="icon-save "></i>保存并提交</button>
			</div>
		</div>
	</form>
    </div>
</div>
</div>

<script>



		
var code;

function article_save_submit()
{
    var phone =  document.getElementById("phone").value;
    if(phone == "")
    {
        alert("请输入手机号");
        return;
    }
    var pwd =  document.getElementById("pwd").value;
    if(pwd == "")
    {
        alert("请输入密码");
        return;
    }

    var carno =  document.getElementById("carno").value;
    if(carno == "")
    {
        alert("请输入车牌");
        return;
    }

     var deviceno =  document.getElementById("deviceno").value;
    if(deviceno == "")
    {
        alert("请输入设备编号");
        return;
    }
    // var posturl = "http://127.0.0.1:8888/myapp/carinterface/register.php?name="+phone+"&pwd="+pwd+"&phone="+phone+"&carnum="+carno+"&devicenum="+deviceno;
	var posturl = "http://118.25.109.93/myapp/carinterface/register.php?name="+phone+"&pwd="+pwd+"&phone="+phone+"&carnum="+carno+"&devicenum="+deviceno;
    // var posturl = "http://127.0.0.1:8888/myapp/carinterface/indexList.php";


    // $.post(posturl,{}, function (data) {
    //     var json_data = data;
    //     var ddd =0;
	// 	alert(data.error_msg);
	// },'json');

 $.ajax({
                type:"POST",
                async:false,
                url:posturl,
                data:{},
                dataType:"json",
                success:function (res) {
                    if(res.error_code == 0)
                    {
                        alert('新增成功');
                        window.opener=null;
        window.open('','_self');
        window.close();
    
                    }

                }
 });


}	
function showCode(str) {
	if (!code) code = $("#code");
	code.empty();
	code.append("<li>"+str+"</li>");
}
		
</script>
<script type="text/javascript">

</script>
</body>
</html>